//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CCPUTimeStat {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CCPUTimeStat(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CCPUTimeStat obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CCPUTimeStat(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CCPUTimeStat() {
    this(nelmiscJNI.new_CCPUTimeStat(), true);
  }

  public static boolean getCPUTicks(SWIGTYPE_p_unsigned_long_long user, SWIGTYPE_p_unsigned_long_long nice, SWIGTYPE_p_unsigned_long_long system, SWIGTYPE_p_unsigned_long_long idle, SWIGTYPE_p_unsigned_long_long iowait) {
    return nelmiscJNI.CCPUTimeStat_getCPUTicks(SWIGTYPE_p_unsigned_long_long.getCPtr(user), SWIGTYPE_p_unsigned_long_long.getCPtr(nice), SWIGTYPE_p_unsigned_long_long.getCPtr(system), SWIGTYPE_p_unsigned_long_long.getCPtr(idle), SWIGTYPE_p_unsigned_long_long.getCPtr(iowait));
  }

  public static boolean getPIDTicks(SWIGTYPE_p_unsigned_long_long utime, SWIGTYPE_p_unsigned_long_long stime, SWIGTYPE_p_unsigned_long_long cutime, SWIGTYPE_p_unsigned_long_long cstime, long pid) {
    return nelmiscJNI.CCPUTimeStat_getPIDTicks(SWIGTYPE_p_unsigned_long_long.getCPtr(utime), SWIGTYPE_p_unsigned_long_long.getCPtr(stime), SWIGTYPE_p_unsigned_long_long.getCPtr(cutime), SWIGTYPE_p_unsigned_long_long.getCPtr(cstime), pid);
  }

  public void peekMeasures() {
    nelmiscJNI.CCPUTimeStat_peekMeasures(swigCPtr, this);
  }

  public float getCPULoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getCPULoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getCPULoad() {
    return nelmiscJNI.CCPUTimeStat_getCPULoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessLoad__SWIG_1(swigCPtr, this);
  }

  public float getCPUUserLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getCPUUserLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getCPUUserLoad() {
    return nelmiscJNI.CCPUTimeStat_getCPUUserLoad__SWIG_1(swigCPtr, this);
  }

  public float getCPUSystemLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getCPUSystemLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getCPUSystemLoad() {
    return nelmiscJNI.CCPUTimeStat_getCPUSystemLoad__SWIG_1(swigCPtr, this);
  }

  public float getCPUNiceLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getCPUNiceLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getCPUNiceLoad() {
    return nelmiscJNI.CCPUTimeStat_getCPUNiceLoad__SWIG_1(swigCPtr, this);
  }

  public float getCPUIOWaitLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getCPUIOWaitLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getCPUIOWaitLoad() {
    return nelmiscJNI.CCPUTimeStat_getCPUIOWaitLoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessUserLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessUserLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessUserLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessUserLoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessSystemLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessSystemLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessSystemLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessSystemLoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessCUserLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessCUserLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessCUserLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessCUserLoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessCSystemLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessCSystemLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessCSystemLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessCSystemLoad__SWIG_1(swigCPtr, this);
  }

  public float getProcessCLoad(CCPUTimeStat.TMeasureType type) {
    return nelmiscJNI.CCPUTimeStat_getProcessCLoad__SWIG_0(swigCPtr, this, type.swigValue());
  }

  public float getProcessCLoad() {
    return nelmiscJNI.CCPUTimeStat_getProcessCLoad__SWIG_1(swigCPtr, this);
  }

  public final static class TMeasureType {
    public final static TMeasureType Instant = new TMeasureType("Instant");
    public final static TMeasureType Mean = new TMeasureType("Mean");
    public final static TMeasureType Peak = new TMeasureType("Peak");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TMeasureType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TMeasureType.class + " with value " + swigValue);
    }

    private TMeasureType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TMeasureType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TMeasureType(String swigName, TMeasureType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TMeasureType[] swigValues = { Instant, Mean, Peak };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
